package com.jfinal.ext.ueditor.config;

import com.jfinal.kit.StrKit;
import org.jetbrains.annotations.NotNull;

import java.util.Collections;
import java.util.List;

/**
 * @author Timor
 * @version 1.0
 * @date 2023/01/04 20:51:58
 */
public class FileManagerConfig extends ActionConfig implements IFileManagerConfig {
    private List<String> listPath = Collections.emptyList();
    private int listSize = 0;


    @Override
    public @NotNull List<String> getListPath() {
        return listPath;
    }

    @Override
    public void setListPath(List<String> listPath) {
        if (null != listPath) {
            final List<String> items = listPath.stream()
                    .filter(StrKit::notBlank).toList();

            if (!listPath.isEmpty()) {
                this.listPath = items;
            }
        }
    }

    @Override
    public void setListPath(String listPath) {
        if (StrKit.notBlank(listPath)) {
            this.listPath = List.of(listPath);
        }
    }

    @Override
    public int getListSize() {
        return listSize;
    }

    @Override
    public void setListSize(int listSize) {
        this.listSize = listSize;
    }

}
